import ArrayQueue from './ArrayQueue'

interface IArrayDeque<T> {
    addFront(value: T): void //可以头部入列
    removeBack(): T | undefined // 可以尾部出列
}

class ArrayDeque<T> extends ArrayQueue<T> implements IArrayDeque<T>{
    addFront(value: T){
        this.data.unshift(value)
    }
    removeBack(){
        return this.data.pop()
    }
}

const deque = new ArrayDeque<number>()
deque.enQueue(3)
deque.enQueue(4)
deque.addFront(2)
deque.addFront(1) 
console.log(deque.toString());

deque.removeBack()
console.log(deque.toString());


